/*
 * BanBu_WebViewController
 * @description 本文件提供加载定位服务,推送服务的html文档的ViewController
 * @package
 * @author 		***
 * @copyright
 * @version 		1.0
 * @description 本文件提供加载定位服务,推送服务的html文档的ViewController
 */

#import "BanBu_WebViewController.h"
#import "AppDataManager.h"
@interface BanBu_WebViewController ()
{
    NoticeOpenType type;
}
@end

@implementation BanBu_WebViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (id)initWIthType:(NoticeOpenType)_type
{
    self = [super init];
    if (self) {
        // Custom initialization
        type = _type;
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    NSString *name = nil;
    switch (type) {
        case NoticeOpenTypeLocation:
        {
            name = @"loc";
            self.title = NSLocalizedString(@"locationPass", 开通地理定位服务);
        }

            break;
        case NoticeOpenTypePush:
        {
            self.title = NSLocalizedString(@"pushidPass", 开通系统推送服务);
            name = @"push";
        }
            break;
        case NoticeOpenTypeNetwork:
        {
            self.title = NSLocalizedString(@"netWorkPass", 打开网络连接);
            name = @"network";
        }
            break;
        default:
            break;
    }
    if(!name) { return ; }
    
    NSString *filePath;
    NSString *langauage=[MyAppDataManager getPreferredLanguage];
    
    if([langauage isEqual:@"zh-Hans"])
    {
        filePath =[[NSBundle mainBundle] pathForResource:name ofType:@"html"];
        
    }
    else if([langauage isEqual:@"ja"])
    {
        filePath =[[NSBundle mainBundle] pathForResource:name ofType:@"html"];
    }
    else
    {
        filePath = [[NSBundle mainBundle] pathForResource:name ofType:@"html"];
    }
//    if([ThemeManager getThemeImage:@"table_backimage.jpg"])
//        aWeb.backgroundColor = [UIColor colorWithPatternImage:[ThemeManager getThemeImage:@"table_backimage.jpg"]];
    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath: filePath]]];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)dealloc {
    [_webView release];
    [super dealloc];
}
- (void)viewDidUnload {
    [self setWebView:nil];
    [super viewDidUnload];
}
@end
